﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Game
{
    public partial class delete_crossword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Request.QueryString["id"]);
            new TblCrossWordQuestionController().Destroy(id);
            var get_details_word = new TblCrossWordDetailsWordController().FetchAll().Where(x => x.CrosswordId == id);
            var get_details_questions = new TblCrossWordDetailsQuestionController().FetchAll().Where(x => x.CrossWordId == id);
            foreach(TblCrossWordDetailsWord word in get_details_word)
            {
                new TblCrossWordDetailsWordController().Destroy(word.Id);
            }
            foreach (TblCrossWordDetailsQuestion question in get_details_questions)
            {
                new TblCrossWordDetailsQuestionController().Destroy(question.Id);
            }
        }
    }
}